The fork
method is used when you want to run another JavaScript file in a separate worker. It’s like having a friend with a specific task. You can communicate with them via messages and they can send messages back to you. The spawn
method is used when you want to run a command in a separate process. It’s like asking someone to do a specific. You can communicate with them via stdin/stdout/stderr, but it’s more like giving orders and getting results.